version 14
set more off

***************************************************************************************************
* THIS ROUTINE GENERATES TABLE A.III OF WASEEM (2019) RESTAT
***************************************************************************************************

use				"$project_data\ExemptionCutoff_06_11.dta", clear
#d				;
matrix 			input table=(2007,0,0,0\0,0,0,0\
							 2008,0,0,0\0,0,0,0\
							 2009,0,0,0\0,0,0,0\
							 2010,0,0,0\0,0,0,0\
							 2010,0,0,0\0,0,0,0\
							 2011,0,0,0\0,0,0,0);
#d				cr
g				double z0=taxableinc
g				double z1=F1.taxableinc
g				logchange=log(z1/z0)
drop 			if z0<=80000 & employee==0
drop 			if z0>500000 & employee==0
drop 			if z0<=140000 & employee==1
drop 			if z0>700000 & employee==1
qui				sum logchange if employee==0,d
drop			if (logchange<r(p1) | logchange>r(p99)) & employee==0 & year<2011
qui				sum logchange if employee==1,d
drop			if (logchange<r(p1) | logchange>r(p99)) & employee==1 & year<2011
local			i=1
local			j=2
local			k=2
qui				tab year, g(ydum)
qui				reg switcher_se ydum2-ydum5 if employee==0 & year<2011, robust
forvalues		y=2007/2010 {
matrix			table[`i',`j']=_b[ydum`k']
matrix			table[`i'+1,`j']=_se[ydum`k']
local			i=`i'+2
local			k=`k'+1
}
matrix			table[`i',`j']=_b[_cons]
matrix			table[`i'+1,`j']=_se[_cons]
local			i=`i'+2
matrix			table[`i',`j']=e(N)
qui				reg switcher_we ydum2-ydum5 if employee==1 & year<2011, robust
local			i=1
local			j=3
local			k=2
forvalues		y=2007/2010 {
matrix			table[`i',`j']=_b[ydum`k']
matrix			table[`i'+1,`j']=_se[ydum`k']
local			i=`i'+2
local			k=`k'+1
}
matrix			table[`i',`j']=_b[_cons]
matrix			table[`i'+1,`j']=_se[_cons]
local			i=`i'+2
matrix			table[`i',`j']=e(N)
svmat			table
keep			tab*
drop			table4
keep			if _n<=11
forvalues		c=1/3 {
g				c`c'=string(table`c',"%15.3f") 
}
forvalues		c=1/3 {
forvalues		r=2(2)10 {
replace			c`c'="("+string(table`c',"%15.3f")+")" in `r'
}
}
forvalues		c=1/3 {
replace			c`c'=string(table`c',"%15.0fc") in 11
}
forvalues		r=2(2)10 {
replace			c1="" in `r'
}
forvalues		r=1(2)9 {
replace			c1=string(table1,"%15.0f") in `r'
}
replace			c1="Constant" in 9
replace			c1="Observations" in 11
forvalues 		s=1/4 {
g				s`s'="&"
}
g				l="\\"
browse			c1 s1 c2 s2 c3 l
